//
// Created by zhangJA on 2020/6/23.
//实验一环境：

//1-用do-while语句编程，求自然数1~10之和。
/*
#include <iostream>
using namespace std;

int main()
{
    int i=1,sum=0;
    do
        {
            sum+=i;
            i++;
        }
    while (i<=10);
    cout<<"sum="<<sum<<endl;
    return 0;
}
*/

//2-用for语句编程，求自然数1~10之和。

/*
#include <iostream>
using namespace std;

int main()
{
    int i=1,sum=0;
    for(i=1;i<=10;i++)
    {
        sum+=i;
    }
    cout<<"sum="<<sum<<endl;
    return 0;
}
*/

//3-
/*
#include <iostream>
using namespace std;

const float Pi=3.1416;

int main()
{
    int iType;
    float radius,a,b,area;
    cout<<"Input your Kinds?(1:circle 2:rectangle 3:square)";
    cin>>iType;
    switch (iType)
    {
        case 1:
            cout<<"R:";
            cin>>radius;
            area=Pi*radius*radius;
            cout<<"Area is:"<<area<<endl;
            break;
        case 2:
            cout<<"L:";
            cin>>a;
            cout<<"W:";
            cin>>b;
            area=a*b;
            cout<<"Area is:"<<area<<endl;
            break;
        case 3:
            cout<<"L:";
            cin>>a;
            area=a*a;
            cout<<"Area is:"<<area<<endl;
            break;
        default:
            cout<<"illegal Input!"<<endl;
    }
}
*/

//4-声明一个表示时间的结构体，可以精准的表示年、月、日、时、分、秒；提示用户输入年、月、日、时、分、秒的值，然后完整地显示出来。

#include <iostream>
using namespace std;
struct MyTimeStruct
{
    unsigned int year;
    unsigned int month;
    unsigned int day;
    unsigned int hour;
    unsigned int min;
    unsigned int sec;
};

int main()
{
    MyTimeStruct myTime={2020,6,23,23,04,00};
    cout<<"please input year:"<<endl;
    cin>>myTime.year;

    cout<<"please input month:"<<endl;
    cin>>myTime.month;

    cout<<"please input day:"<<endl;
    cin>>myTime.day;

    cout<<"please input hour:"<<endl;
    cin>>myTime.hour;

    cout<<"please input min:"<<endl;
    cin>>myTime.min;

    cout<<"please input sec:"<<endl;
    cin>>myTime.sec;

    cout<<"The time is set to:"<<myTime.year<<"/"<<
    myTime.month<<"/"<<myTime.day<<"/"<<myTime.hour<<
    "/"<<myTime.min<<"/"<<myTime.sec<<endl;
}
